<template>
  <keep-alive :include="cachedViews">
<!--    <router-view :key="key" />-->
    <router-view />
  </keep-alive>
</template>
<script>
  export default {
    name: 'RouterViewComponent',
    computed: {
      cachedViews() {
        return this.$store.state.tagsView.cachedViews
      },
      key() {
        return this.$route.path
      },
    },
    created() {
      const route = this.$route.matched.find(item => item.name === this.$options.name)
      if (route) this.$store.dispatch('tagsView/addCachedView', route)
    }
  }
</script>
